import { ref } from 'vue'
export default {
    props: {
        item: Object,
    },
    setup(props, { emit }) {
        const isShowName = ref(true)
        const handleToggle = () => {
            isShowName.value = !isShowName.value
            emit('toggle')

        }
        return { isShowName, handleToggle }
    },
    template: `<div class="user-item">
        <p>用户ID：{{ item.id }}</p>
        <p>用户名：{{ item.name }}</p>
        <p>操作：<button @click="handleToggle">切换显示</button></p>
    </div>`
}